package edu.hawaii.duedates.datastore;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import edu.hawaii.duedates.libraries.ILibrary;

/**
 * A "helper" class for storing the user's list of libraries and their associated filtering 
 * options.
 * 
 * @author Daniel Arakaki, Jeho Jung, Arthur Shum, Daniel Tian.
 */
public class LibraryChoice implements Serializable {
  private static final long serialVersionUID = 1L;
  private ILibrary library;
  private int filter;
  
  /**
   * A convenience method for creating a List of LibraryChoice objects from a List of Library
   * objects.
   * 
   * @param libList A List of Library objects.
   * @return A List of LibraryChoice objects.
   */
  public static List<LibraryChoice> createList(List<ILibrary> libList) {

    List<LibraryChoice> choices = new ArrayList<LibraryChoice>(); 
    for (ILibrary lib : libList) {
      LibraryChoice choice = new LibraryChoice();
      choice.setLibrary(lib);
      choices.add(choice);
    }
    return choices;
  }
  
  /**
   * Sets the library.
   * @param lib The library to set this library to.
   */
  public void setLibrary(ILibrary lib) {
    this.library = lib;
  }
  /**
   * Returns the library.
   * @return the library.
   */
  public ILibrary getLibrary() {
    return this.library;
  }
  /**
   * Returns the filter option.
   * @return the filter option.
   */
  public int getFilter() {
    return this.filter;
  }
  /**
   * Sets the filter.
   * @param filter The value to set the filter to.
   */
  public void setFilter(int filter) {
    this.filter = filter;
  }
}
